/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jhu.profiteer.data;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

/**
 *
 * @author Jeremy
 */
@Entity
public class AirplaneCargo implements Serializable {
  private static final long serialVersionUID = 1L;
  private AirplaneCargoPK id;
  private Long quantity;

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (null != getId() ? getId().hashCode() : 0) +
            (null != quantity ? quantity.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    if (!(object instanceof AirplaneCargo)) {
      return false;
    }
    AirplaneCargo other = (AirplaneCargo) object;
    if ((null == this.getId() && null != other.getId()) ||
        (null != this.getId() &&
         !this.id.equals(other.id))) {
      return false;
    }
    if ((null == this.quantity && null != other.quantity) ||
        (null != this.quantity && !this.quantity.equals(other.quantity))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "jhu.profiteer.data.AirplaneCargo[id=" + getId() +
           ", quantity=" + quantity + "]";
  }

  /**
   * @return the quantity
   */
  public Long getQuantity() {
    return quantity;
  }

  /**
   * @param quantity the quantity to set
   */
  public void setQuantity(Long quantity) {
    this.quantity = quantity;
  }

  /**
   * @return the id
   */
  @EmbeddedId
  public AirplaneCargoPK getId() {
    return id;
  }

  /**
   * @param id the id to set
   */
  public void setId(AirplaneCargoPK id) {
    this.id = id;
  }

}
